package com.czk.model.iterator;

import java.util.Iterator;
import java.util.List;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/5/11 20:19
 */
// 信息工程学院迭代器
public class InformationCollegeIterator implements Iterator {
    // 存放形式
    private List<Department> list;
    // 遍历位置
    private int position = -1;

    public InformationCollegeIterator(List<Department> list) {
        this.list = list;
    }

    @Override
    public boolean hasNext() {
        if (position >= list.size() - 1) {
            return false;
        } else {
            position++;
            return true;
        }

    }

    @Override
    public Object next() {
        return list.get(position);
    }
    // 空实现

    @Override
    public void remove() {

    }
}
